package com.atguigu.test05.Test;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * @author haoranlu
 * @project IntelliJ IDEA
 */
public class TestJdbcTools {
    public static void main(String[] args) throws SQLException {
        String sql1 = "update t_department set description = 'aa' where did = 9";
        String sql2 = "update t_department set description = 'bb' where did = 10";
        Connection conn = JdbcTools.getConnection();
        conn.setAutoCommit(false);

        try {
            JdbcTools.update(sql1);
            JdbcTools.update(sql2);
            conn.commit();
        }catch (Exception e){
            e.printStackTrace();
            conn.rollback();
        }

        conn.setAutoCommit(true);
        JdbcTools.free(conn);

    }

}
